﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HuwmanCode.ServiceProcess;
using System.ComponentModel;

namespace HuwmanCode.Samples.CSWindowsService
{
    [RecoverFromFailures(FailureRecoveryAction.Notify)] //The recover function in Program.cs should be called.
    [StartAfterInstall] //This specifies that the service must start immediately after installation
    [DependsOn(typeof(CSharpWindowsService1))]
    [Description("CSharp Windows Service 2")]  //If this is present is will be used for the service description
    public class CSharpWindowsService2 : WindowsServiceBase
    {
        protected override void OnStart(string[] args)
        {
            //Simulate service failure on startup
            System.Diagnostics.Process.GetCurrentProcess().Kill();
            base.OnStart(args);
        }

        protected override void OnStop()
        {
            base.OnStop();
        }
    }
}
